package com.example.day_20.presenter;

import com.example.day_20.bean.InFoBean;
import com.example.day_20.contract.HomeContract;
import com.example.day_20.model.HomeModel;

public class HomePresenter implements HomeContract.Presenter {

    HomeContract.View homeView;
    private final HomeModel homeModel;

    public HomePresenter(HomeContract.View homeView) {
        this.homeView = homeView;
        homeModel = new HomeModel();
    }

    @Override
    public void getData() {
        homeModel.setData(new HomeContract.CallBack() {
            @Override
            public void onSuccess(InFoBean inFoBean) {
                homeView.onSuccess(inFoBean);
            }

            @Override
            public void onFail(String errorMsg) {
                homeView.onFail(errorMsg);
            }
        });
    }
}
